<template>
  <view>
    <view class=" item-img">
      <view v-for="(item,i) in cart" :key="i" style="width:50%;">
        <view style="position: relative;">
          <image class="img" @click="inToSeeImg(item.goods_src,item.goods_title)" :src="item.goods_src">
          <uni-fab :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical"
            :direction="direction" @trigger="trigger(item.goods_title)"></uni-fab>            
          </image>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: "my-imageslist",
    props: {
      cart: {
        type: Array,
        default: []
      },
      wh: {
        type: String,
        default: ''
      }, // 是否展示图片左侧的 radio
      showRadio: {
        type: Boolean,
        // 如果外界没有指定 show-radio 属性的值，则默认不展示 radio 组件
        default: false,
      },
    },
    data() {
      return {
        pattern: {
          color: '#000',
          backgroundColor: '#fff',
          buttonColor: '#4ce5b1',
          iconColor: '#fff'
        },
        content: [{
            text: '删除',
            active: false
          },
        ],
        horizontal: 'left',
        vertical: 'bottom',
        direction: 'horizontal',
      };
    },
    onShow() {
      console.log(this.props.cart);
    },
    methods: {
      inToSeeImg(item, title) {
        uni.navigateTo({
          url: '/subpkg/goods-img/goods-img?src=' + item + '&title=' + title
        })
      },
      trigger(e) {
        var a=this
          uni.showModal({
          title: '提示',
          content: `确定删除吗？`,
          success: function(res) {
            if (res.confirm) {
              a.$emit('delet',e)
            } else if (res.cancel) {
            }
          }
        })
      },
    }
  }
</script>

<style lang="less">
  .item-img {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
  }

  .item-img .img {
    height: 500rpx;
  }

  .actives {
    width: 100%;
    height: 100%;
  }

  .asd {
    // 让 goods-item 项占满整个屏幕的宽度
    width: 750rpx;
    // 设置盒模型为 border-box
    box-sizing: border-box;
    display: flex;
    padding: 10px 5px;
    border-bottom: 1px solid transparent;
    background-color: aqua;
  }
  .uni-cursor-point{
    position: relative;
  }
</style>
